import { _decorator, Component, instantiate, Node, v3 } from 'cc';
import { Globals } from './Globals';
import { LevelAction } from './LevelAction';
const { ccclass, property } = _decorator;

@ccclass('LayerRootAction')
export class LayerRootAction extends Component {
    
    start() {

    }

    update(deltaTime: number) {
        
    }

    startGame(lvl: number) {
        //加载等级预制体
        let lvlNode = instantiate(Globals.MainAction.levelPrefab);
        //设置等级预制体的位置
        lvlNode.setPosition(v3(0, 0));
        //将等级预制体添加到场景中
        this.node.addChild(lvlNode);

        lvlNode.getComponent(LevelAction).initLevel();
        
    }
}


